Skip to main content

trunc

Type

function

Summary

Returns the integer part of a number.

Syntax

the trunc of <number>
trunc(<number>)

Description

Use the trunc function to round a number down.

The trunc function is different from round in that truncation completely ignores the fractional part of the number. For example, round(4.9) returns 5, but trunc(4.9) returns 4. This means that the trunc function does not always return the integer closest to the number.

Parameters

NameTypeDescription

number

Any number, or expression that evaluates to a number.

Examples

trunc(33.567) -- returns 33
trunc(-6.3) -- returns -6

glossary: return

keyword: integer

constant: return

control structure: function

function: abs, round

Compatibility and Support

Introduced

LiveCode 1.0

OS

mac

windows

linux

ios

android

Platforms

desktop

server

mobile

Thank you for your feedback!

Was this page helpful?